package com.kob.backend.controller.order;

import com.kob.backend.service.order.OrderAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class OrderAddController {
    @Autowired
    private OrderAddService orderAddService;
   @PostMapping("/order/add/")
    public Map<String, String> addorder(@RequestParam Map<String,String>map){
       Integer userid=Integer.parseInt(map.get("userid"));
       Integer shopid=Integer.parseInt(map.get("shopid"));
       Double order_price=Double.parseDouble(map.get("order_price"));
       String order_create=map.get("order_create");
       String productname=map.get("productname");
       return orderAddService.addorder(userid,shopid,order_price,order_create,productname);
   }
}
